package com.spsoft.vatoutinv.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.spsoft.core.annotation.AnonymousAccess;
import com.spsoft.core.annotation.Log;
import com.spsoft.core.controller.BaseController;
import com.spsoft.core.enums.LogActionType;
import com.spsoft.core.enums.LogMenuEnum;
import com.spsoft.core.model.Result;
import com.spsoft.core.utils.SecurityUtils;
import com.spsoft.vatoutinv.model.dto.vmsdifferentialcode.DifferentialCodeLogListDto;
import com.spsoft.vatoutinv.model.dto.vmsdifferentialcode.DifferentialCodeLogPageDto;
import com.spsoft.vatoutinv.model.dto.vmsdifferentialcode.DifferentialCodePageDto;
import com.spsoft.vatoutinv.model.vo.vmsdifferentialcode.DifferentialCodeLogPageVo;
import com.spsoft.vatoutinv.model.vo.vmsdifferentialcode.DifferentialCodePageVo;
import com.spsoft.vatoutinv.service.vmsdifferentialcode.VmsDifferentialCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 差额征税编码信息管理
 *
 * @author wangy
 * @date 2024/3/26 9:52
 */
@Api(tags = {"差额征税编码信息管理"})
@Slf4j
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/vmsDifferentialCode")
public class VmsDifferentialCodeController extends BaseController {

    public static final String LOG_MSG = "(差额征税编码信息管理控制层)";

    private final VmsDifferentialCodeService differentialCodeService;


    /**
     * 差额征税编码信息管理-分页查询
     */
    @ApiOperation("差额征税编码信息管理-分页查询")
    @AnonymousAccess(value = "/page", method = RequestMethod.POST, permissionCode = "VMS_DIFFERENTIAL_TAX_CODE")
    @Log(value = "差额征税编码信息管理-分页查询", type = LogActionType.SELECT, menuName = LogMenuEnum.VMS_DIFFERENTIAL_CODE)
    public Result<IPage<DifferentialCodePageVo>> page(@RequestBody DifferentialCodePageDto dto) {
        log.info("{}-根据部门获取差额征税编码信息管理-参数{}", LOG_MSG, dto);
        return differentialCodeService.page(dto);
    }

    /**
     * 差额征税编码信息管理-更新数据
     */
    @ApiOperation("调用乐企获取差额征税编码信息")
    @AnonymousAccess(value = "/add", method = RequestMethod.POST, permissionCode = "VMS_DIFFERENTIAL_CODE_ADD")
    @Log(value = "调用乐企获取差额征税编码信息", type = LogActionType.UPDATE, menuName = LogMenuEnum.VMS_DIFFERENTIAL_CODE)
    public Result<Object> add() {
        log.info("{}调用乐企获取差额征税编码信息", LOG_MSG);
        return differentialCodeService.getDifferentialCodeByLq(SecurityUtils.getTokenUser());
    }

    /**
     * 差额征税编码信息管理-历史记录列表
     */
    @ApiOperation("差额征税编码信息管理-历史记录列表")
    @AnonymousAccess(value = "/logPage", method = RequestMethod.POST, permissionCode = "VMS_DIFFERENTIAL_TAX_CODE")
    @Log(value = "差额征税编码信息管理-历史记录列表", type = LogActionType.SELECT, menuName = LogMenuEnum.VMS_DIFFERENTIAL_CODE)
    public Result<IPage<DifferentialCodeLogPageVo>> logPage(@RequestBody DifferentialCodeLogPageDto dto) {
        log.info("{}-根据部门获取差额征税编码信息管理历史记录列表-参数{}", LOG_MSG, dto);
        return differentialCodeService.logPage(dto);
    }

    /**
     * 差额征税编码信息管理-历史记录详情
     */
    @ApiOperation("差额征税编码信息管理-历史记录详情")
    @AnonymousAccess(value = "/logDetail", method = RequestMethod.POST, permissionCode = "VMS_DIFFERENTIAL_TAX_CODE")
    @Log(value = "差额征税编码信息管理-历史记录详情", type = LogActionType.SELECT, menuName = LogMenuEnum.VMS_DIFFERENTIAL_CODE)
    public Result<IPage<DifferentialCodePageVo>> logDetail(@RequestBody DifferentialCodeLogListDto dto) {
        log.info("{}-根据部门获取差额征税编码信息管理历史记录详情-参数{}", LOG_MSG, dto);
        return differentialCodeService.logDetail(dto);
    }
}
